﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 委托05_Func
{
    class Program
    {
        static void Main(string[] args)
        {
            // Func代表有返回值的委托
            // 泛型里面，最后一个表示的是返回值的类型
            Func<int> f1 = Test01;
            int i = f1();
            Console.WriteLine(i);

            Func<string, int> f2 = Test02;
            int j = f2("");
            Console.WriteLine(j);

            Func<int, string, bool, char> f3 = Test03;
            char c = f3(1, "", false);
            Console.WriteLine(c);
        }

        public static int Test01()
        {
            return 1;
        }
        public static int Test02(string str)
        {
            return 2;
        }
        public static char Test03(int a, string b, bool c)
        {
            return 'd';
        }
    }
}
